************************************************
***Title: heterogeneity_by_underlying_mental_health.do
***Creators: Joelle Abramowitz, Shooshan Danagoulian, and Owen Fleming*
***Notes: This file produces the main estimates of the effect of pollen exposure on suicides stratified by the presence of underlying mental health condition.

*For questions, contact
*Owen Fleming
*hg3490@wayne.edu
************************************************


**********SETUP
use data/for_analysis, clear


**********PRODUCE ESTIMATES
foreach i in count_no_mh_issue count_any_mh_issue count_mh_prob_or_treat count_mh_treat {

*Treatment: location-season quartiles
eststo s3_`i': ppmlhdfe `i' pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "County, Year x Month, Month x Day"

}


**********EXPORT
estout using results/heterogeneity_by_underlying_mental_health.xls, cells(b(star label(Coef.) fmt(4)) se(par(`"="("'`")""') label(Std. Err.) fmt(4))) stats(ymean N counties Controls FE) starlevels(* 0.1 ** 0.05 *** 0.01) keep(pollen_q2_ls pollen_q3_ls pollen_q4_ls) legend label replace 
eststo clear



